/*
 * @Author: qiuz
 * @Date: 2018-03-27 09:22:30
 * */

import injector from 'angular-es-utils/injector';

// 模板正则
const TEMPLATE_REGEXP = /<.+>/;

export default {

	get(tpl) {

		return injector.get('$q')(resolve => {

			// 如果是一个模板url
			if (!TEMPLATE_REGEXP.test(tpl)) {
				injector.get('$templateRequest')(tpl).then(template => resolve(template));
			} else {
				resolve(tpl);
			}

		});
	}
};
